/*
 * Created on Sun Jul 27 21:07:38 KST 2008
 */
package BundleAnalysis;

import java.util.Properties;

import org.osgi.framework.Bundle;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.ServiceRegistration;


public class Activator implements BundleActivator {
  
	private ServiceRegistration svcreg	=	null;
	private ServiceReference 	svcref	=	null;
	private	BundleAnalyzer		bdAnlzr	=	null;
	private	String				strBundle	=	"BundleAnalysis.BundleAnalyzer";
  /* (non-Javadoc)
   * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
   */
  public void start(BundleContext context) throws Exception {
	  Properties	props	=	new Properties();
	  
	  Bundle[]	bundles	=	context.getBundles();
	  bdAnlzr	=	new	BundleAnalyzerImpl(context);
	  
	  svcreg	=	context.registerService( strBundle, bdAnlzr, props );
	  svcref	=	context.getServiceReference( strBundle );
	  
	  bdAnlzr	=	(BundleAnalyzerImpl) context.getService(svcref);
	  
	  bdAnlzr.Analyze(bundles);
		  
  }

  /* (non-Javadoc)
   * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
   */
  public void stop(BundleContext context) throws Exception {
  }
}